/**
 * 模版页面假数据
 * 用于演示所有功能的UI展示
 */

// 模拟Kafka环境配置
export const mockKafkaConfigs = [
  {
    id: 1,
    config_name: 'KAFKA生产环境(SASL)',
    host: '10.1.1.26',
    port: 9128
  },
  {
    id: 2,
    config_name: 'KAFKA测试环境',
    host: '192.168.1.100',
    port: 9092
  },
  {
    id: 3,
    config_name: 'KAFKA开发环境',
    host: '192.168.1.200',
    port: 9092
  }
]

// 模拟监控数据
export const mockMonitors = [
  {
    id: 1,
    config_id: 1,
    topic_name: 'ods_xhs_note_list_keyword',
    partition_id: 0,
    latest_offset: 6865,
    latest_message: {
      id: '12345',
      content: '示例消息内容',
      timestamp: '2025-11-05 10:30:00'
    },
    message_timestamp: '2025-11-05 10:30:00',
    message_key: 'key_001',
    consumer_lag: 100,
    topic_size_bytes: 104857600,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 24,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx',
    status: 'active',
    alert_first_send_time: '09:30:00',
    alert_second_interval: 7200,
    alert_third_interval: 21600,
    max_alert_count: 3,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-01 08:00:00',
    updated_at: '2025-11-05 10:30:00',
    action_count: 3  // 默认3个操作按钮
  },
  {
    id: 2,
    config_id: 1,
    topic_name: 'ods_user_behavior_log',
    partition_id: 0,
    latest_offset: 12345,
    latest_message: {
      userId: 'user_001',
      action: 'click',
      timestamp: '2025-11-05 09:15:00'
    },
    message_timestamp: '2025-11-05 09:15:00',
    message_key: 'user_001',
    consumer_lag: 50,
    topic_size_bytes: 52428800,
    is_monitored: 1,
    is_alert_enabled: 0,
    alert_threshold_hours: 24,
    webhook_url: '',
    status: 'monitored_only',
    alert_first_send_time: '09:30:00',
    alert_second_interval: 7200,
    alert_third_interval: 21600,
    max_alert_count: 3,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-01 08:00:00',
    updated_at: '2025-11-05 09:15:00',
    action_count: 2  // 2个操作按钮
  },
  {
    id: 3,
    config_id: 1,
    topic_name: 'ods_order_info',
    partition_id: 0,
    latest_offset: 9876,
    latest_message: {
      orderId: 'order_12345',
      amount: 99.99,
      status: 'paid'
    },
    message_timestamp: '2025-10-15 18:00:33',
    message_key: 'order_12345',
    consumer_lag: 2000,
    topic_size_bytes: 209715200,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 24,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx',
    status: 'active',
    alert_first_send_time: '09:30:00',
    alert_second_interval: 7200,
    alert_third_interval: 21600,
    max_alert_count: 3,
    alert_status: 'alerting',
    alert_count: 2,
    last_alert_time: '2025-11-06 09:03:47',
    first_alert_time: '2025-11-06 07:00:00',
    alert_history_id: 123,
    created_at: '2025-10-01 08:00:00',
    updated_at: '2025-11-06 09:03:47',
    action_count: 4  // 4个操作按钮（有重置告警）
  },
  {
    id: 4,
    config_id: 1,
    topic_name: 'ods_product_info',
    partition_id: 0,
    latest_offset: 5432,
    latest_message: {
      productId: 'product_001',
      name: '商品名称',
      price: 199.00
    },
    message_timestamp: '2025-11-04 15:20:00',
    message_key: 'product_001',
    consumer_lag: 300,
    topic_size_bytes: 157286400,
    is_monitored: 0,
    is_alert_enabled: 0,
    alert_threshold_hours: 24,
    webhook_url: '',
    status: 'inactive',
    alert_first_send_time: '09:30:00',
    alert_second_interval: 7200,
    alert_third_interval: 21600,
    max_alert_count: 3,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-10-15 08:00:00',
    updated_at: '2025-11-04 15:20:00',
    action_count: 3  // 3个操作按钮
  },
  {
    id: 5,
    config_id: 1,
    topic_name: 'ods_payment_record',
    partition_id: 0,
    latest_offset: 8765,
    latest_message: {
      paymentId: 'payment_001',
      amount: 299.99,
      method: 'alipay'
    },
    message_timestamp: '2025-11-05 08:45:00',
    message_key: 'payment_001',
    consumer_lag: 150,
    topic_size_bytes: 78643200,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 12,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=yyy',
    status: 'active',
    alert_first_send_time: '08:00:00',
    alert_second_interval: 3600,
    alert_third_interval: 10800,
    max_alert_count: 5,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-01 09:00:00',
    updated_at: '2025-11-05 08:45:00',
    action_count: 1  // 1个操作按钮
  },
  {
    id: 6,
    config_id: 1,
    topic_name: 'ods_inventory_change',
    partition_id: 0,
    latest_offset: 11234,
    latest_message: {
      productId: 'product_002',
      change: 10,
      type: 'in'
    },
    message_timestamp: '2025-11-05 11:20:00',
    message_key: 'product_002',
    consumer_lag: 80,
    topic_size_bytes: 94371840,
    is_monitored: 1,
    is_alert_enabled: 0,
    alert_threshold_hours: 24,
    webhook_url: '',
    status: 'active',
    alert_first_send_time: '09:30:00',
    alert_second_interval: 7200,
    alert_third_interval: 21600,
    max_alert_count: 3,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-10-20 08:00:00',
    updated_at: '2025-11-05 11:20:00',
    action_count: 2  // 2个操作按钮
  },
  {
    id: 7,
    config_id: 1,
    topic_name: 'ods_user_login_log',
    partition_id: 0,
    latest_offset: 15678,
    latest_message: {
      userId: 'user_002',
      ip: '192.168.1.100',
      timestamp: '2025-11-05 12:00:00'
    },
    message_timestamp: '2025-11-05 12:00:00',
    message_key: 'user_002',
    consumer_lag: 25,
    topic_size_bytes: 62914560,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 6,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=zzz',
    status: 'active',
    alert_first_send_time: '08:00:00',
    alert_second_interval: 1800,
    alert_third_interval: 5400,
    max_alert_count: 10,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-02 09:00:00',
    updated_at: '2025-11-05 12:00:00',
    action_count: 3  // 3个操作按钮
  },
  {
    id: 8,
    config_id: 1,
    topic_name: 'ods_system_event',
    partition_id: 0,
    latest_offset: 2345,
    latest_message: {
      event: 'system_start',
      timestamp: '2025-11-05 13:15:00'
    },
    message_timestamp: '2025-11-05 13:15:00',
    message_key: 'system_event',
    consumer_lag: 500,
    topic_size_bytes: 31457280,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 12,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=system',
    status: 'active',
    alert_first_send_time: '09:00:00',
    alert_second_interval: 3600,
    alert_third_interval: 10800,
    max_alert_count: 5,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-03 10:00:00',
    updated_at: '2025-11-05 13:15:00',
    action_count: 4  // 4个操作按钮
  },
  {
    id: 9,
    config_id: 1,
    topic_name: 'ods_data_sync',
    partition_id: 0,
    latest_offset: 98765,
    latest_message: {
      syncId: 'sync_001',
      source: 'mysql',
      target: 'starrocks'
    },
    message_timestamp: '2025-11-05 14:30:00',
    message_key: 'sync_001',
    consumer_lag: 200,
    topic_size_bytes: 209715200,
    is_monitored: 1,
    is_alert_enabled: 1,
    alert_threshold_hours: 2,
    webhook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=sync',
    status: 'active',
    alert_first_send_time: '08:00:00',
    alert_second_interval: 600,
    alert_third_interval: 1800,
    max_alert_count: 20,
    alert_status: 'normal',
    alert_count: 0,
    last_alert_time: null,
    first_alert_time: null,
    alert_history_id: null,
    created_at: '2025-11-04 08:00:00',
    updated_at: '2025-11-05 14:30:00',
    action_count: 5  // 5个操作按钮，需要"更多"下拉
  }
]

// 模拟统计数据
export const mockStats = {
  active_count: 3,
  monitored_count: 4,
  alert_enabled_count: 3,
  alerting_count: 1
}

// 模拟Topic列表
export const mockTopicsList = [
  'ods_xhs_note_list_keyword',
  'ods_user_behavior_log',
  'ods_order_info',
  'ods_product_info',
  'ods_payment_record',
  'ods_inventory_change',
  'ods_user_login_log'
]

// 模拟字段配置（用于字段设置功能演示）
export const mockFieldConfig = {
  basic: [
    { label: 'ID', value: 'id', required: true },
    { label: 'Topic名称', value: 'topic_name', required: true },
    { label: '分区ID', value: 'partition_id', required: true }
  ],
  status: [
    { label: '状态', value: 'status' },
    { label: '告警状态', value: 'alert_status' },
    { label: '监控开关', value: 'is_monitored' },
    { label: '告警开关', value: 'is_alert_enabled' }
  ],
  time: [
    { label: '最新消息时间', value: 'message_timestamp' },
    { label: '最后告警时间', value: 'last_alert_time' },
    { label: '更新时间', value: 'updated_at' },
    { label: '创建时间', value: 'created_at' }
  ],
  other: [
    { label: '最新Offset', value: 'latest_offset' },
    { label: '消费滞后', value: 'consumer_lag' },
    { label: '告警阈值', value: 'alert_threshold_hours' },
    { label: '告警次数', value: 'alert_count' }
  ]
}

// 模拟API延迟
export const mockApiDelay = (ms = 500) => {
  return new Promise(resolve => setTimeout(resolve, ms))
}

